﻿<UserControl x:Class="ThuPhap.Controls.TextControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    d:DesignHeight="70" d:DesignWidth="480">
    
    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <TextBox Visibility="Collapsed" 
                 Name="TextBoxTextControl" 
                 TextChanged="TextBoxTextControl_TextChanged"
                 DoubleTap="TextBoxTextControl_DoubleTap"
                 Text="Text Control"
                 VerticalAlignment="Center" 
                 HorizontalContentAlignment="Center" 
                 BorderThickness="2" 
                 AcceptsReturn="True" 
                 Grid.Row="0"
                 Background="Transparent"
                 KeyUp="TextBoxTextControl_KeyUp"
                 TextWrapping="Wrap">
            <toolkit:GestureService.GestureListener>
                <toolkit:GestureListener DragDelta="TextBoxGestureListener_DragDelta"></toolkit:GestureListener>
            </toolkit:GestureService.GestureListener>
        </TextBox>
        <TextBlock 
            Grid.Row="0"
            Visibility="Visible" 
            Name="TextBlockTextControl"
            VerticalAlignment="Center" 
            HorizontalAlignment="Left" 
            TextAlignment="Left"
            Width="{Binding ElementName= TextBoxTextControl,Path=Width}"
            Text="{Binding ElementName=TextBoxTextControl,Path=Text}" 
            FontSize="{Binding ElementName=TextBoxTextControl,Path=FontSize}" 
            
            TextWrapping="Wrap" 
            Margin="17"
            >
        </TextBlock>
        <Image Name="ResizeImage" Visibility="Collapsed" DoubleTap="ResizeImage_DoubleTap" Grid.Row="1" Width="40" Height="40" VerticalAlignment="Bottom" HorizontalAlignment="Right" Source="/ThuPhap;component/Resources/Images/resize.png" Margin="0,-20,-20,0">
            <toolkit:GestureService.GestureListener>
                <toolkit:GestureListener DragStarted="GestureListener_DragStarted" DragDelta="GestureListener_DragDelta"></toolkit:GestureListener>
            </toolkit:GestureService.GestureListener>
        </Image>
    </Grid>
</UserControl>
